"""
统计指标
"""
import pandas as pd
import numpy as np

data = pd.read_json('ratings.json')
# print(data)
fracture = data.loc['Fracture']

# 均值
# print(np.mean(fracture))
# 默认axis=0垂直方向，水平方向axis=1
# print(data.mean(axis=1))

# 加权均值
weights = [1,10,1,1,1,10,1]
# print(np.average(fracture,weights=weights))

# 最大值索引
# print(np.argmax(fracture))
# print(fracture.idxmax())

# 最小值
# print(np.argmin(fracture))
# print(fracture.idxmin())

# 中位数
print(np.median(fracture))

# 标准差
# print(data.std)
# print(fracture.std()) # 样本
print(np.std(fracture))
# print(np.std(fracture,ddof=1)) # 总体